package edu.usc.tweetool.util;

import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.ImageIO;

public class ImageFileSystem {
	public static String saveImage(BufferedImage image) {
		return null;
	}

	public static String saveImage(BufferedImage image, String path, String name) {
		File file = null;
		try {
			file = new File(path + "/image/" + name + ".png");
			System.out.println(file.getPath());
			if (!file.exists()) {
				file.createNewFile();
			}
			ImageIO.write(image, "png", file);

		} catch (Exception e) {
			e.printStackTrace();
		}
		return "image/" + name + ".png";
	}
	
	private static ImageFileSystem ifs = null;
	public static ImageFileSystem getInstance(){
		if(ifs == null){
			ifs = new ImageFileSystem ();
		}
		return ifs;
	}
	
	private ImageFileSystem(){
		
	}
}
